# 18feb12kernigh
# (c) Software Lab. Alexander Burger

# from OpenBSD 5.0

# errno
(equ ENOENT 2)       # No such file or directory
(equ EINTR 4)        # Interrupted system call
(equ EBADF 9)        # Bad file number
(equ EAGAIN 35)      # Resource temporarily unavailable
(equ EACCES 13)      # Permission denied
(equ EPIPE 32)       # Broken pipe
(equ ECONNRESET 54)  # Connection reset by peer

# open/fcntl
(equ O_RDONLY 0)
(equ O_WRONLY 1)
(equ O_RDWR 2)
(equ O_CREAT 512)
(equ O_EXCL 2048)
(equ O_TRUNC 1024)
(equ O_APPEND 8)
(equ F_GETFD 1)
(equ F_SETFD 2)
(equ FD_CLOEXEC 1)

# stdio
(equ BUFSIZ 1024)
(equ PIPE_BUF 512)    # <sys/syslimits.h>

(equ MAXPATHLEN 1024) # <sys/param.h> and <sys/syslimits.h>

# dlfcn
(equ RTLD_LAZY 1)
(equ RTLD_GLOBAL 256)

# fcntl
(equ FLOCK 24)    # File lock structure
(equ L_TYPE 20)   # 2
(equ L_WHENCE 22) # 2
(equ L_START 0)
(equ L_LEN 8)
(equ L_PID 16)
(equ SEEK_SET 0)  # <stdio.h>
(equ SEEK_CUR 1)
(equ F_RDLCK 1)
(equ F_WRLCK 3)
(equ F_UNLCK 2)
(equ F_GETFL 3)
(equ F_SETFL 4)
(equ F_GETLK 7)
(equ F_SETLK 8)
(equ F_SETLKW 9)
(equ F_SETOWN 6)
(equ O_NONBLOCK 4)
(equ O_ASYNC 64)

# stat
(equ STAT 144)    # File status structure
(equ ST_MODE 8)   # 4
(equ ST_SIZE 80)
# FIXME time_t is 4 bytes
(equ ST_MTIME 48) # 4
(equ S_IFMT (oct "0170000"))
(equ S_IFDIR (oct "0040000"))

# times
(equ TMS 16)      # 'times' structure
# FIXME clock_t is 4 bytes
(equ TMS_UTIME 0) # 4
(equ TMS_STIME 4) # 4

# termios
(equ TERMIOS 44)  # Terminal I/O structure
(equ C_IFLAG 0)
(equ C_LFLAG 12)
(equ C_CC 16)
(equ ISIG 128)
(equ VMIN 16)
(equ VTIME 17)
(equ TCSADRAIN 1)

# signal
(equ SIGACTION 152)  # Sigaction structure
(equ SIGSET_T 4)
(equ SA_HANDLER 0)
(equ SA_MASK 8)
(equ SA_FLAGS 12)

(equ SIG_DFL 0)
(equ SIG_IGN 1)
(equ SIG_UNBLOCK 2)

(equ SIGHUP 1)  # Signals
(equ SIGINT 2)
(equ SIGUSR1 30)
(equ SIGUSR2 31)
(equ SIGPIPE 13)
(equ SIGALRM 14)
(equ SIGTERM 15)
(equ SIGCHLD 20)
(equ SIGCONT 19)
(equ SIGSTOP 17)
(equ SIGTSTP 18)
(equ SIGTTIN 21)
(equ SIGTTOU 22)
(equ SIGIO 23)
(equ SIGNALS 33)  # Highest used signal number plus 1

# wait
(equ WNOHANG 1)
(equ WUNTRACED 2)

# select
(equ FD_SET 128)  # 1024 bit

# time
(equ TM_SEC 0)
(equ TM_MIN 4)
(equ TM_HOUR 8)
(equ TM_MDAY 12)
(equ TM_MON 16)
(equ TM_YEAR 20)

# dir
(equ D_NAME 8)

# Sockets
(equ SOCK_STREAM 1)           # <sys/socket.h>
(equ SOCK_DGRAM 2)
(equ AF_UNSPEC 0)
(equ AF_INET6 24)
(equ SOL_SOCKET (hex "FFFF"))
(equ SO_REUSEADDR 4)
(equ IPPROTO_IPV6 41)         # <netinet/in.h>
(equ IPV6_V6ONLY 26)          # <netinet6/in6.h>
(equ INET6_ADDRSTRLEN 46)

(equ NI_MAXHOST 256)  # <netdb.h> and <sys/param.h>
(equ NI_NAMEREQD 8)

(equ SOCKADDR_IN6 28)
# FIXME sa_family_t is 1 byte
(equ SIN6_FAMILY 1)   # 1
(equ SIN6_PORT 2)
(equ SIN6_ADDR 8)

(equ ADDRINFO 48)
(equ AI_FAMILY 4)
(equ AI_SOCKTYPE 8)
(equ AI_ADDRLEN 16)
(equ AI_ADDR 24)
(equ AI_NEXT 40)

# vi:et:ts=3:sw=3
